﻿using System;
using System.Collections.Generic;
using System.Data;
using Loki.Data;

namespace Luna.Data.Budget
{
    /// <summary>
    /// Mapper for data interface IAccountData.
    /// </summary>
    public partial class AccountDataMapper : LunaMapper<AccountData, IAccountData> 
    {
        public AccountDataMapper()
        {
            GetAllRequest = "Budget.account_select_all";
            GetRequest = "Budget.account_select";
            InsertRequest = "Budget.account_insert";
            UpdateRequest = "Budget.account_update";
            DeleteRequest = "Budget.account_delete";
        }
        
        private const string NameColumnName = "Name";

        protected override void LoadCoreData(IAccountData entity, IDataRecord record)
        {
            entity.Name = record.GetString(NameColumnName);
        }
        
        protected override void MapSaveParameters(IDatabaseCommand command, IAccountData entity)
        {
            command.AddParameter(NameColumnName, entity.Name);
            command.AddParameter(IDParameterName, entity.PK);
        }
           
    }
}